﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

public partial class CurrentUser : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
            MembershipUser u = Membership.GetUser();
            if (u == null)
            {
                Response.Write("var userlogged = false;");
                Response.Write("var userCreationDate = '';");
                Response.Write("var userEmail = '';");
                Response.Write("var userIsApproved = '';");
                Response.Write("var userIsLockedOut = '';");
                Response.Write("var userIsOnline = '';");
                Response.Write("var userLastActivityDate = '';");
                Response.Write("var userLastLockoutDate = '';");
                Response.Write("var userLastLoginDate = '';");
                Response.Write("var userUserName = '';");
            }
            else
            {
                Response.Write("var userlogged = true;");
                Response.Write("var userCreationDate = '"+u.CreationDate.ToString("dd/MM/yyyy")+"';");
                Response.Write("var userEmail = '"+u.Email+"';");
                Response.Write("var userIsApproved = '"+u.IsApproved.ToString()+"';");
                Response.Write("var userIsLockedOut = '"+u.IsLockedOut+"';");
                Response.Write("var userIsOnline = '"+u.IsOnline+"';");
                Response.Write("var userLastActivityDate = '"+u.LastActivityDate.ToString("dd/MM/yyy hh:mm")+"';");
                Response.Write("var userLastLockoutDate = '"+u.LastLockoutDate.ToString("dd/MM/yyyy hh:mm")+"';");
                Response.Write("var userLastLoginDate = '"+u.LastLoginDate.ToString("dd/MM/yyyy hh:mm")+"';");
                Response.Write("var userUserName = '"+u.UserName+"';");
            }
        
        
    }
}